#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stddef.h>
#include "SAdefine.h"
#include "SAtest.h"


int mock_checkInOut(int x, char * str){
    
    check_expect(x);
    check_expect_s(str);

    return mock();
}

void test1(int8_t type)
{
    will_return(mock_checkInOut,4);
    will_return(mock_checkInOut,5);
    expect_value(mock_checkInOut,x,10);
    expect_value(mock_checkInOut,str,"hello world");
    assert_int_equal(mock_checkInOut(12,"hello"),6);
}

int show(){
    printf("hello world!");
    int * x = sa_malloc(sizeof(int));
    return 0;
}


void test2(int8_t type)
{
    show();
}

int calculate(int x, int y){
    return x*y;
}

void test3(int8_t type)
{
    assert_value_arrange(calculate(1,2),0,1);
    char * s = "hello world";
    assert_string_equal("hello world",s);
}

int x = 0;
char y = 0;

void func(){
    x = 10;
    y = 20;
}

void test4(int8_t type)
{
    add_global_variable_track(x);
    add_global_variable_track(y);
    create_whiteList(1,&x);
    func();
    check_global_variable_changed();
}

int main() {
    UnitTest tests[] = {
        unit_test(test1,1),
        unit_test(test2,1),
        unit_test(test3,1),
        unit_test(test4,1)
    };
    run_tests(tests);
    return 0;
}
